package com.ruoyi.web.controller.danger;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysDangerKeep;
import com.ruoyi.system.service.ISysDangerKeepService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dangerKeep")
public class SysDangerKeepController extends BaseController {

    @Autowired
    private ISysDangerKeepService sysDangerKeepService;

    @PostMapping("/create")
    public AjaxResult create(@RequestBody SysDangerKeep sysDangerKeep) {
        sysDangerKeepService.create(sysDangerKeep);
        return AjaxResult.success();
    }

    @GetMapping("/list")
    public TableDataInfo list() {
        startPage();
        List<SysDangerKeep> sysDangerKeepList = sysDangerKeepService.list();
        return getDataTable(sysDangerKeepList);
    }

    @GetMapping("/delete")
    public AjaxResult delete(Integer id) {
        sysDangerKeepService.delete(id);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody SysDangerKeep sysDangerKeep) {
        sysDangerKeepService.update(sysDangerKeep);
        return AjaxResult.success();
    }

    @GetMapping("/deleteFile")
    public AjaxResult deleteFile(Integer id) {
        sysDangerKeepService.deleteFile(id);
        return AjaxResult.success();
    }

}
